<script setup>
import { ref, defineProps, useSlots } from 'vue';
import { ElCard } from 'element-plus';

// 定义props
const props = defineProps({
  // 页面标题
  title: {
    type: String,
    required: true
  }
});

// 使用插槽
const slots = useSlots();
</script>

<template>
  <div class="common-layout-container">
    <!-- 标题+操作按钮区 -->
    <el-card>
      <template #header>
        <div class="card-header">
          <span>{{ title }}</span>
          <div class="header-buttons">
            <slot name="header-buttons"></slot>
          </div>
        </div>
      </template>

      <!-- 搜索区 -->
      <div class="search-area">
        <slot name="search-form"></slot>
      </div>

      <!-- 数据区 -->
      <div class="data-area">
        <slot name="data-content"></slot>
      </div>
    </el-card>
  </div>
</template>

<style scoped>

.common-layout-container {
  padding: 3px;
  box-sizing: border-box;
  background-color: #f5f7fa;
  min-height: 100vh;
}

.card-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.header-buttons {
  display: flex;
  gap: 10px;
}

.search-area {
  margin: 16px 0;
}

.search-area .el-form {
  /* 设置为行内表单 */
  display: flex;
  flex-wrap: wrap;
  gap: 16px;
}



.data-area {
  margin-top: 16px;
}

</style>